3.1.13 \(\int \frac {\sec (x)}{a+b \csc (x)} \, dx\) [13]

Optimal. Leaf size=54 \[ -\frac {\log (1-\sin (x))}{2 (a+b)}+\frac {\log (1+\sin (x))}{2 (a-b)}-\frac {b \log (b+a \sin (x))}{a^2-b^2} \]

[Out]

-1/2*ln(1-sin(x))/(a+b)+1/2*ln(1+sin(x))/(a-b)-b*ln(b+a*sin(x))/(a^2-b^2)

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 54, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.273, Rules used = {3957, 2800, 815} \begin {gather*} -\frac {b \log (a \sin (x)+b)}{a^2-b^2}-\frac {\log (1-\sin (x))}{2 (a+b)}+\frac {\log (\sin (x)+1)}{2 (a-b)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Sec[x]/(a + b*Csc[x]),x]

[Out]

-1/2*Log[1 - Sin[x]]/(a + b) + Log[1 + Sin[x]]/(2*(a - b)) - (b*Log[b + a*Sin[x]])/(a^2 - b^2)

Rule 815

Int[(((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_)))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Int[ExpandIntegrand[(
d + e*x)^m*((f + g*x)/(a + c*x^2)), x], x] /; FreeQ[{a, c, d, e, f, g}, x] && NeQ[c*d^2 + a*e^2, 0] && Integer
Q[m]

Rule 2800

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(p_.), x_Symbol] :> Dist[1/f, Subst[I
nt[(x^p*(a + x)^m)/(b^2 - x^2)^((p + 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x] && NeQ[a^2
 - b^2, 0] && IntegerQ[(p + 1)/2]

Rule 3957

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.), x_Symbol] :> Int[(g*Co
s[e + f*x])^p*((b + a*Sin[e + f*x])^m/Sin[e + f*x]^m), x] /; FreeQ[{a, b, e, f, g, p}, x] && IntegerQ[m]

Rubi steps

\begin {align*} \int \frac {\sec (x)}{a+b \csc (x)} \, dx &=\int \frac {\tan (x)}{b+a \sin (x)} \, dx\\ &=\text {Subst}\left (\int \frac {x}{(b+x) \left (a^2-x^2\right )} \, dx,x,a \sin (x)\right )\\ &=\text {Subst}\left (\int \left (\frac {1}{2 (a+b) (a-x)}+\frac {1}{2 (a-b) (a+x)}+\frac {b}{(-a+b) (a+b) (b+x)}\right ) \, dx,x,a \sin (x)\right )\\ &=-\frac {\log (1-\sin (x))}{2 (a+b)}+\frac {\log (1+\sin (x))}{2 (a-b)}-\frac {b \log (b+a \sin (x))}{a^2-b^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.08, size = 64, normalized size = 1.19 \begin {gather*} \frac {(-a+b) \log \left (\cos \left (\frac {x}{2}\right )-\sin \left (\frac {x}{2}\right )\right )+(a+b) \log \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )-b \log (b+a \sin (x))}{(a-b) (a+b)} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Sec[x]/(a + b*Csc[x]),x]

[Out]

((-a + b)*Log[Cos[x/2] - Sin[x/2]] + (a + b)*Log[Cos[x/2] + Sin[x/2]] - b*Log[b + a*Sin[x]])/((a - b)*(a + b))

________________________________________________________________________________________

Maple [A]
time = 0.08, size = 55, normalized size = 1.02

method result size
default \(-\frac {\ln \left (-1+\sin \left (x \right )\right )}{2 a +2 b}+\frac {\ln \left (\sin \left (x \right )+1\right )}{2 a -2 b}-\frac {b \ln \left (b +a \sin \left (x \right )\right )}{\left (a +b \right ) \left (a -b \right )}\) \(55\)
norman \(\frac {\ln \left (\tan \left (\frac {x}{2}\right )+1\right )}{a -b}-\frac {\ln \left (\tan \left (\frac {x}{2}\right )-1\right )}{a +b}-\frac {b \ln \left (b \left (\tan ^{2}\left (\frac {x}{2}\right )\right )+2 a \tan \left (\frac {x}{2}\right )+b \right )}{a^{2}-b^{2}}\) \(63\)
risch \(-\frac {i x}{a -b}+\frac {i x}{a +b}+\frac {2 i x b}{a^{2}-b^{2}}+\frac {\ln \left (i+{\mathrm e}^{i x}\right )}{a -b}-\frac {\ln \left ({\mathrm e}^{i x}-i\right )}{a +b}-\frac {b \ln \left ({\mathrm e}^{2 i x}-1+\frac {2 i b \,{\mathrm e}^{i x}}{a}\right )}{a^{2}-b^{2}}\) \(105\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sec(x)/(a+b*csc(x)),x,method=_RETURNVERBOSE)

[Out]

-1/(2*a+2*b)*ln(-1+sin(x))+1/(2*a-2*b)*ln(sin(x)+1)-b/(a+b)/(a-b)*ln(b+a*sin(x))

________________________________________________________________________________________

Maxima [A]
time = 0.26, size = 48, normalized size = 0.89 \begin {gather*} -\frac {b \log \left (a \sin \left (x\right ) + b\right )}{a^{2} - b^{2}} + \frac {\log \left (\sin \left (x\right ) + 1\right )}{2 \, {\left (a - b\right )}} - \frac {\log \left (\sin \left (x\right ) - 1\right )}{2 \, {\left (a + b\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)/(a+b*csc(x)),x, algorithm="maxima")

[Out]

-b*log(a*sin(x) + b)/(a^2 - b^2) + 1/2*log(sin(x) + 1)/(a - b) - 1/2*log(sin(x) - 1)/(a + b)

________________________________________________________________________________________

Fricas [A]
time = 2.84, size = 47, normalized size = 0.87 \begin {gather*} -\frac {2 \, b \log \left (a \sin \left (x\right ) + b\right ) - {\left (a + b\right )} \log \left (\sin \left (x\right ) + 1\right ) + {\left (a - b\right )} \log \left (-\sin \left (x\right ) + 1\right )}{2 \, {\left (a^{2} - b^{2}\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)/(a+b*csc(x)),x, algorithm="fricas")

[Out]

-1/2*(2*b*log(a*sin(x) + b) - (a + b)*log(sin(x) + 1) + (a - b)*log(-sin(x) + 1))/(a^2 - b^2)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\sec {\left (x \right )}}{a + b \csc {\left (x \right )}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)/(a+b*csc(x)),x)

[Out]

Integral(sec(x)/(a + b*csc(x)), x)

________________________________________________________________________________________

Giac [A]
time = 0.41, size = 53, normalized size = 0.98 \begin {gather*} -\frac {a b \log \left ({\left | a \sin \left (x\right ) + b \right |}\right )}{a^{3} - a b^{2}} + \frac {\log \left (\sin \left (x\right ) + 1\right )}{2 \, {\left (a - b\right )}} - \frac {\log \left (-\sin \left (x\right ) + 1\right )}{2 \, {\left (a + b\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)/(a+b*csc(x)),x, algorithm="giac")

[Out]

-a*b*log(abs(a*sin(x) + b))/(a^3 - a*b^2) + 1/2*log(sin(x) + 1)/(a - b) - 1/2*log(-sin(x) + 1)/(a + b)

________________________________________________________________________________________

Mupad [B]
time = 0.19, size = 53, normalized size = 0.98 \begin {gather*} \frac {\ln \left (\sin \left (x\right )+1\right )}{2\,\left (a-b\right )}-\frac {\ln \left (\sin \left (x\right )-1\right )}{2\,\left (a+b\right )}-\frac {b\,\ln \left (b+a\,\sin \left (x\right )\right )}{a^2-b^2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(cos(x)*(a + b/sin(x))),x)

[Out]

log(sin(x) + 1)/(2*(a - b)) - log(sin(x) - 1)/(2*(a + b)) - (b*log(b + a*sin(x)))/(a^2 - b^2)

________________________________________________________________________________________